package system.imp;

import java.io.DataInputStream;

import system.base.Balance;
import system.base.BillSequence;
import system.base.CheckHead;
import system.base.ClientDownupfileInfo;
import system.base.InHead;
import system.base.InSub;
import system.base.Position;
import system.base.WarehouseProduct;
import system.base.WarehouseStaff;
import framework.core.DBConnection;
import framework.core.ILoginContext;


/**
 * 导入Excel文件到数据库
 */
public class GWFileUpProcessor implements GWBaseProcesser{

   
    public static String doExcelSaveToDB(DataInputStream aFile, DBConnection con, ILoginContext loginContext,String tableName,String warehouseCode) throws GWException
    {
        return doExcelSaveToDB(aFile,con,loginContext,tableName,warehouseCode,ClientDownupfileInfo.DOWNLOADTYPE_DOWN);
    }
    public static String doExcelSaveToDB(DataInputStream aFile, DBConnection con, ILoginContext loginContext,String tableName,String warehouseCode,String upDownType) throws GWException
    {
        String strReturn ="";
        
        //T_IN_HEAD表的处理
        if (tableName.equalsIgnoreCase(InHead.TABLE_NAME))
        {
            strReturn = ExcelInHeadToDB.doSaveToDB(aFile, con, loginContext,tableName,warehouseCode,upDownType);
        }
      //T_POSITION表的处理
        if (tableName.equalsIgnoreCase(Position.TABLE_NAME))
        {
            strReturn = ExcelPositionToDB.doSaveToDB(aFile, con, loginContext,tableName,warehouseCode,upDownType);
        }
      //T_WAREHOUSE_STAFF表的处理
        if (tableName.equalsIgnoreCase(WarehouseStaff.TABLE_NAME))
        {
            strReturn = ExcelWarehouseStaffToDB.doSaveToDB(aFile, con, loginContext,tableName,warehouseCode,upDownType);
        }
      //T_WAREHOUSE_PRODUCT表的处理
        if (tableName.equalsIgnoreCase(WarehouseProduct.TABLE_NAME))
        {
            strReturn = ExcelWarehouseProductToDB.doSaveToDB(aFile, con, loginContext,tableName,warehouseCode,upDownType);
        }
      //T_IN_SUB表的处理
        if (tableName.equalsIgnoreCase(InSub.TABLE_NAME))
        {
            strReturn = ExcelInSubToDB.doSaveToDB(aFile, con, loginContext,tableName,warehouseCode,upDownType);
        }
      //T_BILL_SEQUENCE表的处理
        if (tableName.equalsIgnoreCase(BillSequence.TABLE_NAME))
        {
            strReturn = ExcelBillSequenceToDB.doSaveToDB(aFile, con, loginContext,tableName,warehouseCode,upDownType);
        }
      //T_BALANCE表的处理
        if (tableName.equalsIgnoreCase(Balance .TABLE_NAME))
        {
            strReturn = ExcelBalanceToDB.doSaveToDB(aFile, con, loginContext,tableName,warehouseCode,upDownType);
        }
      //T_CHECK_HEAD表的处理
        if (tableName.equalsIgnoreCase(CheckHead .TABLE_NAME))
        {
            strReturn = ExcelCheckHeadToDB.doSaveToDB(aFile, con, loginContext,tableName,warehouseCode,upDownType);
        }
        //T_BALANCE表的处理
        if (tableName.equalsIgnoreCase(Balance .TABLE_NAME))
        {
            strReturn = ExcelBalanceToDB.doSaveToDB(aFile, con, loginContext,tableName,warehouseCode,upDownType);
        }
        return strReturn;
    }
    

}